package com.hsd.factory;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Customer {

    @Test
    public void buy001(){
        BMWFactory factory = new BMWFactory();
        BMW bmw = factory.buildBMWCar("550");
        bmw.carInfo();
    }

    /**
     * spring测试
     */
    @Test
    public void buy002(){
        ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
        BMW bmw530 = (BMW) context.getBean("bmw530");
        BMW bmw550 = (BMW) context.getBean("bmw550");
        BMW bmwx6 = (BMW) context.getBean("bmwx6");
        bmw530.carInfo();
        bmw550.carInfo();
        bmwx6.carInfo();
    }
}
